package com.tancire.question.service.impl;

import java.util.List;
import javax.annotation.Resource;

import com.tancire.common.utils.DateUtils;
import org.springframework.stereotype.Service;
import com.tancire.question.mapper.TrainProblemTypeMapper;
import com.tancire.question.domain.TrainProblemType;
import com.tancire.question.service.ITrainProblemTypeService;

/**
 * 问题类型Service业务层处理
 *
 * @author tancire
 * @date 2024-10-09
 */
@Service
public class TrainProblemTypeServiceImpl implements ITrainProblemTypeService {
    @Resource
    private TrainProblemTypeMapper trainProblemTypeMapper;

    /**
     * 查询问题类型
     *
     * @param id 问题类型主键
     * @return 问题类型
     */
    @Override
    public TrainProblemType selectTrainProblemTypeById(Long id) {
        return trainProblemTypeMapper.selectTrainProblemTypeById(id);
    }

    /**
     * 查询问题类型列表
     *
     * @param trainProblemType 问题类型
     * @return 问题类型
     */
    @Override
    public List<TrainProblemType> selectTrainProblemTypeList(TrainProblemType trainProblemType) {
        return trainProblemTypeMapper.selectTrainProblemTypeList(trainProblemType);
    }

    /**
     * 新增问题类型
     *
     * @param trainProblemType 问题类型
     * @return 结果
     */
    @Override
    public int insertTrainProblemType(TrainProblemType trainProblemType) {
        trainProblemType.setCreateTime(DateUtils.getNowDate());
        return trainProblemTypeMapper.insertTrainProblemType(trainProblemType);
    }

    /**
     * 修改问题类型
     *
     * @param trainProblemType 问题类型
     * @return 结果
     */
    @Override
    public int updateTrainProblemType(TrainProblemType trainProblemType) {
        trainProblemType.setUpdateTime(DateUtils.getNowDate());
        return trainProblemTypeMapper.updateTrainProblemType(trainProblemType);
    }

    /**
     * 批量删除问题类型
     *
     * @param ids 需要删除的问题类型主键
     * @return 结果
     */
    @Override
    public int deleteTrainProblemTypeByIds(Long[] ids) {
        return trainProblemTypeMapper.deleteTrainProblemTypeByIds(ids);
    }

    /**
     * 删除问题类型信息
     *
     * @param id 问题类型主键
     * @return 结果
     */
    @Override
    public int deleteTrainProblemTypeById(Long id) {
        return trainProblemTypeMapper.deleteTrainProblemTypeById(id);
    }
}
